package com.atguigu.cloud.user.controller;

import com.atguigu.cloud.user.config.MyConfigProperties;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/api/config")
@RefreshScope //让当前类使用的配置中心的配置热更新
@RestController
public class ConfigController {
    @Value("${app.name}")
    String appName;

    @Resource
    MyConfigProperties myConfigProperties;
    @GetMapping("test1")
    public String test1(){
        System.out.println("appName: "+appName);

        System.out.println(myConfigProperties);

        return "success-test1";
    }


}
